<template>
  <div id="ContactUs">
    <div class="banner container-fuild text-center">积分兑换</div>
    <div class="container">
      <van-divider />
      
      <div class="row_bw warp">
            <van-card
            style="width:24%"
            v-for="i in list"
            class="cus"
            @click="go_xq(i)"
            :key="i.id"
            :price="i.prices"
            :desc="i.keyword"
            :title="i.pname"
            :thumb="$base+ i.zimg"
          />

          </div>

      <van-divider />
    </div>
  </div>
</template>
<script>
import { WOW } from "wowjs";
import BMap from "BMap";
export default {
  name: "Jifen",
  data() {
    return {
      user: "",
      list: [],
      time: [],
    };
  },
  mounted() {
    let suer = JSON.parse(localStorage.getItem("user"));
    this.user = suer;
    var wow = new WOW();
    wow.init();
    // this.get_jifen();
    this.get_list();
  },
  methods: {
      go_xq(e){
          this.$router.push({path:'/jifengood',query:{info:e} })
      },
  timeTrans(date){
    var date = new Date(date*1000);
    var Y = date.getFullYear() + '-';
    var M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';
    var D = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate()) + ' ';
    var h = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':';
    var m = (date.getMinutes() <10 ? '0' + date.getMinutes() : date.getMinutes()) + ':';
    var s = (date.getSeconds() <10 ? '0' + date.getSeconds() : date.getSeconds());
    return Y+M+D+h+m+s;
},




get_list(){
  let data={
    fenlei:69,
    page:1,
    pagesize:100,
    pname:''
  };
  let v=this;
  this.http.post('/products/getproducts',data).then(res=>{
      console.log('兑换列表:',res);
      if(res.data.data){
         v.list=res.data.data
      };

  });

},

    get_jifen() {
      let v = this;
      this.http.post("/cusmsg/getjifenmsg").then((res) => {
        console.log("积分:", res);
        if (res.data.code == 1) {
          v.list = res.data.data;

          let dd = res.data.data;
          for (let i of dd) {
            let tt = v.timeTrans(i.createtime);
            v.time.push(tt);
          }

        } else {
          alert(res.data.msg);
        }
      });
    },

  },
};
</script>
<style scoped>
.center {
  display: flex;
  align-items: center;
  width: 100%;
  justify-content: center;
  flex-direction: column;
}
.banner {
  color: #fff;
  font-size: 30px;
  height: 150px;
  line-height: 150px;
  background-image: url("../assets/img/banner_1.jpg");
  background-repeat: no-repeat;
  background-size: cover;
  background-attachment: scroll;
  background-position: center center;
}
.ContactUs-container {
  padding: 80px 0;
  transition: all ease 0.5s;
  box-sizing: border-box;
}
#map {
  width: 100%;
  height: 365px;
}
.row {
  margin-right: 0;
  margin-left: 0;
}
@media screen and (max-width: 997px) {
  .ContactUs-container {
    padding: 20px 0;
  }
}
</style>

